//
//  UserNameTableViewCell.m
//  FVQuickMessage
//
//  Created by dllo on 16/8/22.
//  Copyright © 2016年 zty. All rights reserved.
//

#import "UserNameTableViewCell.h"

@interface UserNameTableViewCell ()

@property (nonatomic, retain) UIImageView *headerImageView;
@property (nonatomic, retain) UILabel *nameLabel;
@property (nonatomic, retain) UILabel *numberLabel;
@property (nonatomic, retain) UIButton *erButton;

@end

@implementation UserNameTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.headerImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:_headerImageView];
        
        
        self.nameLabel = [[UILabel alloc] init];
        [self.contentView addSubview:_nameLabel];
        
        self.numberLabel = [[UILabel alloc] init];
        [self.contentView addSubview:_numberLabel];
        
        [self config];
        
    }
    return self;
}

-(void)config {
    
    [self.headerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(self.contentView).with.offset(10);
        make.left.equalTo(self.contentView).with.offset(10);
        make.width.offset(50);
        make.height.offset(50);
        
    }];
    
    /*[self.headerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.contentView).with.offset(10);
        make.left.equalTo(self.contentView).with.offset(10);
        make.width.offset(50);
        make.height.offset(50);
        
    }];*/
    self.headerImageView.layer.masksToBounds = YES;
    self.headerImageView.layer.cornerRadius = 25;
    self.headerImageView.backgroundColor = [UIColor orangeColor];
    self.headerImageView.image = [UIImage imageNamed:@"Icon"];
    
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.contentView).with.offset(20);
        make.left.equalTo(self.headerImageView.mas_right).with.offset(10);
        make.width.offset(WIDTH * 0.6);
        make.height.offset(20);
        
    }];
    
    /*[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        
        make.top.equalTo(self.contentView).with.offset(20);
        make.left.equalTo(self.headerImageView.mas_right).with.offset(10);
        make.width.offset(WIDTH * 0.6);
        make.height.offset(20);
        
    }];*/
    // self.nameLabel.backgroundColor = [UIColor greenColor];
    
    
    // self.nameLabel.text = self.userName;
    
    
    [self.numberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(self.nameLabel).with.offset(25);
        make.left.equalTo(self.headerImageView.mas_right).with.offset(10);
        make.width.offset(WIDTH * 0.6);
        make.height.offset(20);
        
    }];
    
    /*[self.numberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.nameLabel).with.offset(25);
        make.left.equalTo(self.headerImageView.mas_right).with.offset(10);
        make.width.offset(WIDTH * 0.6);
        make.height.offset(20);
        
    }];*/
    // self.numberLabel.backgroundColor = [UIColor greenColor];
    // self.numberLabel.text = self.userName;
    
}

-(void)setUserName:(NSString *)userName {
    
    if (_userName != userName) {
        _userName = userName;
    }
    
    self.nameLabel.text = userName;
    
    self.numberLabel.text = userName;
    
}

@end
